
import * as ActionTypes from '../../../constants/constants.js'
import * as util from '../../../util/utils.js'

export const goodsDetails = (state = null, action) => {
    switch (action.type) {
        case ActionTypes.goodsDetails:
            return action.data
        case ActionTypes.goodsDetailsError:
            state.error = action.data.error
            return {
                ...state,
                ...action.data
            }
        default:
            return state;
    }
}

export const goodsAttr = (state = null, action) => {
    switch (action.type) {
        case ActionTypes.goodsAttr:
            return action.data
        case ActionTypes.goodsAttrError:
            state.error = action.data.error
            return {
                ...state,
                ...action.data
            }
        default:
            return state;
    }
}
